package com.idig8.day08;


/**
 * @program: java-show
 * @description: 栈的技术实现
 * @author: LiMing
 * @create: 2020-04-13 10:36
 **/
public class Stack<E> {
    private List<E> list = (List<E>) new ArrayList<E>();

    public void clear() {
        list.clear();
    }

    public int size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void push(E element) {
        list.add(element);
    }


    public E pop() {
        return list.remove(list.size() - 1);
    }


    public E top() {
        return list.get(list.size() - 1);
    }
}
